#!/usr/bin/env python

import json

def getLangsListFromJson():
    jsonPath = "build/jrd_perso_gen/languages_table_list.json"
    fIn = open(jsonPath, 'rb')
    text = fIn.read()
    fIn.close()
    langsList = json.loads(text)
    #print "Languages list is: %s" % langsList
    return langsList

def getLangsDictFromLangsList(langsList):
    langsDict = {}
    for lang in langsList:
        key = lang[1]
        value = lang[0]
        langsDict[key] = value
    #print "Languages dict is: %s" % langsDict
    return langsDict

def getLangsShortnameDictFromlangsList(langsList):
    langsDict = {}
    for lang in langsList:
        key = lang[0]
        value = lang[1]
        langsDict[key] = value
    #print "Languages shortname dict is: %s" % langsDict
    return langsDict